package com.kma.summer2012.dao;

import com.kma.summer2012.model.User;

import java.math.BigInteger;
import java.util.*;

public class UserDAO {

    public Map<BigInteger, User> STUB = new HashMap<BigInteger, User>();

    public UserDAO() {
        User user1 = new User();
        User user2 = new User();
        User user3 = new User();
        User user4 = new User();//param
        //2
        user1.setId(new BigInteger("1"));
        user2.setId(new BigInteger("2"));
        user3.setId(new BigInteger("3"));
        user4.setId(new BigInteger("4"));

        user1.setName("User" + user1.getId());
        user2.setName("User" + user2.getId());
        user3.setName("User" + user3.getId());
        user4.setName("User" + user4.getId());

        user1.setPosition("Manager");
        user2.setPosition("Operator");
        user3.setPosition("Engineer");
        user4.setPosition("Engineer");

        STUB.put(user1.getId(), user1);
        STUB.put(user2.getId(), user2);
        STUB.put(user3.getId(), user3);
        STUB.put(user4.getId(), user4);
    }

    public User getUserById(BigInteger id) {
        return STUB.get(id);
    }

    public Collection<User> getAllUsers() {
        return STUB.values();
    }


}
